package com.txc.common.utils.thread;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 线程池配置
 *
 * @ClassName: ThreadPoolProperties
 * @Author: TXC
 * @Date: 2023-08-15 11:08
 **/
@Data
@Component
@ConfigurationProperties(prefix = "cloud.thread.pool")
public class ThreadPoolProperties {
    /**
     * 线程池名
     */
    private String poolName = "ThreadPool";
    /**
     * 等待队列长度
     */
    private int queueCapacity = 1000;
    /**
     * 闲置线程存活时间
     */
    private int keepAliveSeconds = 60 * 10;
    /**
     * 最大线程数
     */
    private int maxPoolSize = Runtime.getRuntime().availableProcessors() * 2 + 1;
    /**
     * 核心线程数
     */
    private int corePoolSize = maxPoolSize - 1;
}
